package VerificationCode;

import java.util.Random;
import java.util.Scanner;

public class Exercise2 {
    public static void main(String[] args) {
        String line="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Random rand=new Random();
        Scanner scan=new Scanner(System.in);
        String code="";
        for (int i=0;i<4;i++){
            int number=rand.nextInt(line.length());
            char c=line.charAt(number);
            code+=c;
        }
        System.out.println("验证码"+code);

        String input=scan.nextLine();
        if (input.equalsIgnoreCase(code)){
            System.out.println("输入正确");
        }else {
            System.out.println("输入错误");
        }
    }
}
